package com.cjy.common.utils.tag;

import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.components.Anchor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Writer;

/**
 * 自定义A标签Bean
 * User: jay.zhoujingjie
 * Date: 13-12-20
 * Time: 下午3:02
 */
public class ATagBean extends Anchor
{
	//是否可见
    private boolean visible;

    public ATagBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response)
    {
        super(stack, request, response);
    }

    /**
     * Overrides to be able to render body in a template rather than always before the template
     */
    @Override
    public boolean end(Writer writer, String body)
    {
        if (visible)
        {
            return super.end(writer, body);
        } else
        {
            return false;
        }
    }

    public void setVisible(boolean visible)
    {
        this.visible = visible;
    }
}
